<?php
require_once 'config.php';
$id = '';
if(isset($_GET['id'])){
    $id = $_GET['id'];

}
$box = new Template(TEMPLATE_DIR.'home-dienthoai-box.html');

$dt = new DienThoai();

$g = new PGlobal();

$row = $dt->run('SELECT madt AS pid, tendt AS pname, giadt AS pprice, hinhdt AS pimgurl FROM dienthoai WHERE madt =:id',
    array('id' => $id));
$box['dienthoai-box-item'] = $g->renderBoxPhone($row[0]);
$box['title'] = $row[0]['pname'];

$row = $dt->select('madt=:madt', array('madt' => $id));

$chitietdt = new Template(TEMPLATE_DIR. 'chitietdienthoai.html');
$chitietdt->setArray($row[0]);
$chitietdt['dienthoai-item'] = $box->render();

$page =PGlobal::getLayoutTemplate();

$page['content'] = $chitietdt->render();

$page->addCss('css/home.css');
$page->addCss('css/chitietdienthoai.css');

echo $page->render();